package com.zhc.dejingapi.service.upload.impl;

import com.zhc.dejingapi.pojo.qingflow.QingflowApiInfo;
import com.zhc.dejingapi.service.upload.IERPProdClassUploadService;
import com.zhc.dejingapi.utils.qing.accessTokenUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class ERPProdClassUploadServiceImpl implements IERPProdClassUploadService {


    @Autowired
    QingflowApiInfo qingflowApiInfo;

    //@Autowired
    //private final RedisTemplate<String,Object> redisTemplate;

    private final JdbcTemplate mysqlJdbcTemplate;

    public ERPProdClassUploadServiceImpl( @Qualifier("mySqlJdbcTemplate")JdbcTemplate mysqlJdbcTemplate1) {
        //this.redisTemplate = redisTemplate1;
        this.mysqlJdbcTemplate = mysqlJdbcTemplate1;
    }

    @Override
    public boolean uploadProdClass() {
        boolean bOk=false;

        try{

             //redisTemplate.opsForValue().set("testKey","testValue");

            String accessToken= accessTokenUtils.getAccessToken(qingflowApiInfo);
            if(accessToken==null||accessToken.isEmpty())
            {
                bOk=false;
            }

            String strUrl = qingflowApiInfo.getServerUrl();
            strUrl+= qingflowApiInfo.getBaseUrl();
            strUrl+="app/";




        }
        catch (Exception e)
        {
            log.error(e.getMessage()+e.getStackTrace());
        }

        return bOk;
    }
}
